package com.ngmaster.socket.handler;

import com.ngmaster.socket.MessageHandler;
import com.ngmaster.socket.message.ReadOrModifyOneWaterOfTimeMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ReadOrModifyOneWaterOfTimeMessageHandler extends MessageHandler<ReadOrModifyOneWaterOfTimeMessage> {

    @Override
    public boolean handleMessage(ReadOrModifyOneWaterOfTimeMessage protocolMessage) {
        log.info("[ReadOrModifyOneWaterOfTimeMessageHandler] [receive] [msg:{}]", protocolMessage);
        if (protocolMessage.getMinutes() > 0) { // 表示读取
            super.handleMessage(protocolMessage);
        }
        return true;
    }

    @Override
    public String getApiUrl() {
        return super.getApiUrl() + "rw_one_water_of_time";
    }

}
